package com.clgc.eduservice.controller;

import com.clgc.eduservice.entity.KcbjTask;
import com.clgc.eduservice.service.KcbjTaskService;
import com.clgc.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author cml
 * @create 2021/5/19 16:24
 */
@RestController
@RequestMapping("/eduservice/kcbj-task")
public class KcbjTaskController {

    @Autowired
    KcbjTaskService kcbjTaskService;

    @PutMapping("/create")
    public R create(@RequestBody KcbjTask kcbjTask) {
        boolean save = kcbjTaskService.save(kcbjTask);
        return save ? R.ok() : R.error().message("课程班级挂载到作业失败");
    }

    @DeleteMapping("/delete/{id}")
    public R deleteById(@PathVariable("id") String id) {
        boolean remove = kcbjTaskService.removeById(id);
        return remove ? R.ok() : R.error().message("删除失败");
    }
}
